//
//  UIView+Extension.swift
//  WeiDo
//
//  Created by XISHAN on 16/3/3.
//  Copyright © 2016年 XISHAN. All rights reserved.
//

import UIKit

extension UIView{
    
    //@IBInspectable修饰的属性可以在xib右边控制面板显示
    @IBInspectable var borderWidth:CGFloat{
    
        get{
            return layer.borderWidth
        }
        set{
            layer.borderWidth = newValue
        }
    
    }
    
    @IBInspectable var borderColor:UIColor? {
        
        get{
            guard let color = layer.borderColor else{
                return nil
            }
            return UIColor(CGColor: color)
        }
        set{
            layer.borderColor = newValue?.CGColor
        }
        
    }
    
    @IBInspectable var cornerRadius:CGFloat{
        get{
            return layer.cornerRadius
        }
        set{
            layer.cornerRadius = newValue
            layer.masksToBounds = newValue > 0
        }
    }
    
//    textField.layer.borderWidth = 1
//    textField.layer.borderColor = UIColor.blackColor().CGColor
//    textField.layer.cornerRadius = 10

    
    
}
